package org.boyan.modules.service.impl;

import org.boyan.modules.service.WSDLService;
import org.springframework.stereotype.Service;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

@Service
public class WSDLServiceImpl implements WSDLService {

    @Override
    public boolean runWsdl(String s) {
        InputStream in=null;
        StringBuffer stringBuffer=new StringBuffer();
        try {
            Process runProcess= Runtime.getRuntime().exec(s);
            in=runProcess.getInputStream();
            BufferedReader bufferedReader=new BufferedReader(new InputStreamReader(in));
            runProcess.waitFor();
            String line;
            while ((line=bufferedReader.readLine())!=null){
                stringBuffer.append(line);
            }
            System.out.println(stringBuffer.append(line));
        } catch (IOException | InterruptedException e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }

}
